<?php

namespace App\Http\Controllers\Manage;

use App\Model\LoginLog;
use App\Model\Role;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;

class LoginLogController extends Controller
{
    /**
     * 登录日志列表
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        #获取用户角色id,用户名
        $role_id = session('user.role_id');

        if($role_id != 1){
            $name = session('user.name');
            #获取该用户的登录日志
            $log = LoginLog::where('username',$name)->orderBy('create_time','desc')->paginate(10);
        }else{
            #获取所有登录日志信息
            $log = LoginLog::orderBy('create_time','desc')->paginate(10);
        }

        return view('manage.system.login_log',['log'=>$log,'active1'=>16,'active2'=>3]);
   }
}
